package com.nineclock.document.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nineclock.document.pojo.DocFile;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;


@Mapper
@Repository
public interface DocFileMapper  extends BaseMapper<DocFile> {
    @Select("SELECT t2.* from doc_file t2 INNER JOIN doc_collaborations t1  ON " +
            "t1.file_id=t2.id WHERE t1.file_id =#{Id} and t1.collaboration_id = #{userId} and t2.permission=2")
    DocFile queryCollaboration(@Param("Id") Long Id,@Param("userId") Long userId);
}
